package pers.jsan.litheopen.security.oauth.model;

import pers.jsan.litheopen.utils.MD5Util;

import java.sql.Timestamp;

public class LitheAuthenticationToken {

    private Object principal;
    private Object credentials;
    private Timestamp loginTime;

    public LitheAuthenticationToken() {

    }

    public LitheAuthenticationToken(Object principal, Object credentials) {
        this.principal = principal;
        this.credentials = credentials;
        this.loginTime = new Timestamp(System.currentTimeMillis());
    }

    public Object getPrincipal() {
        return principal;
    }

    public void setPrincipal(Object principal) {
        this.principal = principal;
    }

    public Object getCredentials() {
        return credentials;
    }

    public void setCredentials(Object credentials) {
        this.credentials = credentials;
    }

    public Timestamp getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Timestamp loginTime) {
        this.loginTime = loginTime;
    }

    public String getToken() {
        return MD5Util.encryption32(principal.toString() + loginTime.toString());
    }
}
